package com.control;

/**
 * Version: 1.1
 * Author: TangJun
 * Date: 2024-07-27
 */
public class A extends Thread{
    private boolean loop = true;

    @Override
    public void run() {
        while (loop) {
            System.out.println((int)(Math.random()*100 + 1));
            try {
                Thread.sleep(500);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        System.out.println("A线程退出");
    }
    public void setLoop(boolean loop) {
        this.loop = loop;
    }
}
